package com.styytech.dadabao.ui.pullrefreshfragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;

import com.styytech.dadabao.base.BaseFragment;
import com.styytech.dadabao.widge.pulltorefresh.PullToRefreshBase;
import com.styytech.dadabao.widge.pulltorefresh.PullToRefreshListView;

public class BasePullfreshFragment extends BaseFragment implements
		InterfaceBaseFragment, OnItemClickListener {

	protected PullToRefreshListView mPullRefreshListView;

	protected PullToRefreshBase.OnRefreshListener mOnrefreshListener = new PullToRefreshBase.OnRefreshListener() {
		public void onRefresh() {
			voidPullRefresh(mPullRefreshListView.getRefreshType());
		}
	};

	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState, int layoutId) {
		return super.onCreateView(inflater, container, savedInstanceState,layoutId);
	}

	/**
	 * 初始化组件
	 */
	public void setView(PullToRefreshListView mPullRefreshListView) {
		this.mPullRefreshListView = mPullRefreshListView;
	}

	/**
	 * 下拉或者上拉回调
	 */
	public void voidPullRefresh(int pullType) {

		if (pullType == PullToRefreshBase.MODE_PULL_DOWN_TO_REFRESH) {// 下拉
			pullDownToRefresh();
		}
		if (pullType == PullToRefreshBase.MODE_PULL_UP_TO_REFRESH) {// 上拉
			pullUpToRefresh();
		}

	}

	/***
	 * 下拉刷新
	 */
	@Override
	public void pullDownToRefresh() {
		// TODO Auto-generated method stub

	}

	/**
	 * 上拉刷新
	 */
	@Override
	public void pullUpToRefresh() {
		// TODO Auto-generated method stub

	}

	/**
	 * 下拉刷新完毕
	 */
	@Override
	public void onRefreshComplete() {
		// TODO Auto-generated method stub
		mPullRefreshListView.onRefreshComplete();
	}

	/**
	 * 刷新全部数据
	 */
	@Override
	public void refreshData() {
		// TODO Auto-generated method stub

	}

	/**
	 * 点击事件
	 */
	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		// TODO Auto-generated method stub
		onClick(arg2);
	}

	/**
	 * 点击事件
	 */
	@Override
	public void onClick(int position) {
		// TODO Auto-generated method stub

	}


	/**
	 * 设置数据列表
	 */
	@Override
	public void setAdapter(BaseAdapter adapter) {
		// TODO Auto-generated method stub

	}

	@Override
	public void setFailureView(String msg) {

	}


	@Override
	public void setEmptyDateShow(int httpType) {
		// TODO Auto-generated method stub
		
	}


}
